package com.kuyun.base.mail;

import java.util.HashMap;
import java.util.Map;

import com.kuyun.base.mail.service.MailService;
import com.kuyun.base.mail.service.impl.MailServiceImpl;

import junit.framework.TestCase;

/**
 * 邮件发送测试
 * ClassName: TestSendMail <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason: TODO ADD REASON(可选). <br/>
 * date: 2015年12月28日 下午9:22:30 <br/>
 *
 * @author yanglei
 * @version 
 * @since jdk1.7
 */
public class TestSendMail extends TestCase {

	MailService mailService = null;

	@Override
	protected void setUp() throws Exception {
		mailService = new MailServiceImpl();
		super.setUp();
	}

/*	public void testSendText() {
		System.out.println(MailUtil.constructMailFrom("yanglei", "25512181@qq.com"));;
		mailService.sendText("tianwei7518@163.com", "测试", "邮件发送测试");
	}*/

	public void testSendTextByTemplate() {
		Map<String, String> map = new HashMap<String, String>();
		map.put("name", "武汉自来水");
		map.put("date", "2015-12-28");
		mailService.sendHtml("954218947@qq.com", "你好", "mail.ftl", map);
	}

	/*public void testSendHtml() {
		mailService.sendHtml("25512181@qq.com", "测试HTML",
				"<div>fdsfsfsda<h2>fdsfsafd</h2></div>");
	}

	public void testSendHtmlByTemplate() {
		Map<String, String> map = new HashMap<String, String>();
		map.put("name", "武汉自来水");
        map.put("date", "2015-12-28");
		mailService.sendHtml("25512181@qq.com", "你好", "mail.ftl", map);
	}

	public void testSendHtmlAndAttachmentsByTemplate() {
		Map<String, String> map = new HashMap<String, String>();
		map.put("name", "武汉自来水");
        map.put("date", "2015-12-28");
		mailService.sendHtml("25512181@qq.com", "你好", "mail.ftl", map,
				new File[] { new File("stat.properties"),
						new File("server_bak.xml") });
	}
*/
}
